<?php

$signature = $_GET['signature'];
$timestamp = $_GET['timestamp'];
$nonce = $_GET['nonce'];
$echostr = $_GET['echostr'];
$token = 'hahaha';

//根据文档已经获得了所有的参数，下一步进行字典排序
$arr = [$timestamp,$nonce,$token];
//file_put_contents('data.php',$arr);
sort($arr,SORT_STRING);
//将三个数拆分成字符串进行sha1加密
$str = implode($arr);
$strimg = sha1($str);

//file_put_contents('data.php',$strimg);
//file_put_contents('abc.php',$signature);
//最后将加密过后的字符串与$signature进行比较
if ($strimg == $signature){

    echo $echostr;

}

//都OK




?>